package edu.ntnu.superrss.utils;

import com.sun.syndication.feed.synd.SyndEntry;
import edu.ntnu.superrss.models.SyndEntryImpl;
import java.util.Comparator;

/**
 * Comparators for sorting SyndEntry
 * @author Sigurd Fosseng <sigurd at fosseng.net>
 */
public class SyndEntrySort {

    /**
     * Comparator for sorting SyndEntry by PublishedDate
     */
    public static final Comparator<SyndEntry> DATE_ORDER = new Comparator<SyndEntry>() {

        public int compare(SyndEntry t, SyndEntry t1) {
            return t1.getPublishedDate().compareTo(t.getPublishedDate());
        }
    };
    public static final Comparator<SyndEntry> URI_ORDER = new Comparator<SyndEntry>() {
        public int compare(SyndEntry t, SyndEntry t1) {
            return t1.getUri().compareTo(t.getUri());
        }
    };
    public static final Comparator<SyndEntryImpl> THUMB_ORDER = new Comparator<SyndEntryImpl>(){
        public int compare(SyndEntryImpl t, SyndEntryImpl t1) {
            return t1.getThumbsUp().compareTo(t.getThumbsUp());
        }
    };
}
